From 85e18a4b485d6ca807514b4ad9e578055ed1f6bb Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 9 May 2007 17:09:08 +0000 Subject: [PATCH] (vc-find-root): Stop searching when the user changes. --- lisp/ChangeLog | 4 ++++ lisp/vc-hooks.el | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3d79beb5412..4a6c88be187 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2007-05-09 Stefan Monnier + + * vc-hooks.el (vc-find-root): Stop searching when the user changes. + 2007-05-09 Edward O'Connor (tiny change) * progmodes/python.el (python-font-lock-keywords) diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index d67a0262d88..1bde704790b 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el @@ -315,10 +315,17 @@ If WITNESS if not found, return nil, otherwise return the root." ;; Represent /home/luser/foo as ~/foo so that we don't try to look for ;; witnesses in /home or in /. (setq file (abbreviate-file-name file)) - (let ((root nil)) + (let ((root nil) + (user (nth 2 (file-attributes file)))) (while (not (or root (equal file (setq file (file-name-directory file))) (null file) + ;; As a heuristic, we stop looking up the hierarchy of + ;; directories as soon as we find a directory belonging + ;; to another user. This should save us from looking in + ;; things like /net and /afs. This assumes that all the + ;; files inside a project belong to the same user. + (not (equal user (file-attributes file))) (string-match vc-ignore-dir-regexp file))) (if (file-exists-p (expand-file-name witness file)) (setq root file) -- 2.30.2